<%@ page import="java.net.InetAddress" %>
<%@ page import="java.util.*" %>
<%@ page import="java.net.NetworkInterface" %>
<%@ page import="java.net.Inet4Address" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    String ip = request.getHeader("x-forwarded-for");
    if(null == ip || 0 == ip.length() || "unknown".equalsIgnoreCase(ip)) {
        ip = request.getHeader("Proxy-Client-IP");
    }
    if(null == ip || 0 == ip.length() || "unknown".equalsIgnoreCase(ip)) {
        ip = request.getHeader("WL-Proxy-Client-IP");
    }
    if(null == ip || 0 == ip.length() || "unknown".equalsIgnoreCase(ip)) {
        ip = request.getHeader("X-Real-IP");
    }
    if(null == ip || 0 == ip.length() || "unknown".equalsIgnoreCase(ip)) {
        ip = request.getRemoteAddr();
    }
%>
IP地址是：<%=ip %>
</body>
</html>
